<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateTableArticleDataStatisticsDay extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article_statistics_day', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('dateAt')->default(0)->comment('统计日');
            $table->unsignedInteger('articleId')->default(0)->comment('文章 ID, 0为所有');
            $table->unsignedInteger('source')->default(0)
                  ->comment('数据来源0默认 1: 点赞数, 2:收藏数 3:转发数 4:阅读数 5:展示数');
            $table->unsignedInteger('cumulateNum')->default(0)->comment('累计');
            $table->unsignedInteger('newNum')->default(0)->comment('新增');
            $table->unsignedInteger('cancelNum')->default(0)->comment('取消');
            $table->unsignedInteger('netIncNum')->default(0)->comment('净增');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger('isDeleted')->default(0)->comment('');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '文章_统计_日';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article_statistics_day');
    }
}
